import { onScopeDispose } from 'vue'
import bus from '@/libs/bus'

const openEventName = 'open-widget-animations-setting'

// 发送控件动画设置事件
export const emitOpenAnimationsSettingEvent = data => {
    bus.emit(openEventName, data)
}

// 接收控件动画设置事件
export const onOpenAnimationsSettingEvent = callback => {
    bus.on(openEventName, callback)

    onScopeDispose(() => {
        bus.off(openEventName, callback)
    })
}